package com.potato.network.bean;

import android.os.Parcelable;

import com.potato.network.exception.ApiException;
import io.reactivex.functions.Function;

public class HttpResultFunc<T extends Parcelable> implements Function<BaseEntity<T>, T> {

    @Override
    public T apply(BaseEntity<T> httpResult) throws Exception {
        if (httpResult.code!=200) {
            throw new ApiException(httpResult.code,httpResult.message);
        }
        return httpResult.results;
    }
}
